package com.thinkgem.jeesite.common;

import java.io.Serializable;

/**
 *
 * @author 程展峰
 * 接口返回基类 
 * @Param data 实际数据
 *
 *@Param code 与http状态码无关,1表示成功,0表示前台数据不正确,返回预期之外的值,与业务数据无关包括后台报错
 * @Param code 与http状态码无关,1表示成功,99表示后台错误(报错),0前台数据不正确,返回预期之外的值,与业务数据无关
 */
public class R implements Serializable{
	private R() {};

	private  R(String code, Object data,Object msg) {
		super();
		this.code = code;
		this.data = data;
		this.msg = msg;
	}

	public static R newR() {

		return new R();
	}
	public static R newR(String code,Object data,Object msg) {

		return new R(code,data,msg);
	}
	public static R ok(Object data) {

		return new R("1",data,null);
	}

	public static R fail(Object msg) {

		return new R("0",null,msg);
	}
	public static R error(Object msg) {

		return new R("99",null,msg);
	}
	public static R noLogin(Object msg) {
		return new R("22",null,msg);
	}
	private String code;
	private Object data;
	private Object msg;


	public Object getMsg() {
		return msg;
	}

	public void setMsg(Object msg) {
		this.msg = msg;
	}

	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object date) {
		this.data = date;
	}

}
